package com.jiyun.admin.controller;

import com.domain.User;
import com.jiyun.admin.service.impl.UserServiceImpl;
import com.spyx.common.result.Result;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author li
 * @since 2024-12-18
 */
@RestController
@RequestMapping("/user")
public class UserController {

    private final UserServiceImpl userService;

    public UserController(UserServiceImpl userService){
        this.userService = userService;
    }

    @RequestMapping("/login")
    public Result login(@RequestBody User user){
        return userService.login(user);
    }

    @GetMapping("/getUserById/{id}")
    public User getUserById(@PathVariable(value = "id") Integer id){
        return userService.getById(id);
    }



}
